package com.matrix.java.chap_04;

import java.util.Scanner;

/*
    转换字母等级为数字
 */
public class Ex4_14 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter a letter grade: ");
        String letter = input.next();
        int number = 0;
        switch (letter) {
            case "A":
                number = 4;
                break;
            case "B":
                number = 3;
                break;
            case "C":
                number = 2;
                break;
            case "D":
                number = 1;
                break;
            case "F":
                number = 0;
                break;
            default:
                System.out.println(letter + " is an invalid grade");
        }
        System.out.println("The numeric value for grade"+letter+" is "+number);
        input.close();
    }
}
